<?php
/**
 * 错误处理类
 */
namespace Hi;

class Exceptions extends \Exception {

    /**
     * 构造
     * @param string $message 错误信息
     * @param int $code       错误代码
     */
    public function __construct($message, $code = 0) {
        parent::__construct($message, $code);
    }

    public function __toString() {
        if (SHOW_ERROR === true) {
            return parent::__toString();
        } else {
            self::showErrorPage($this->code);
        }
    }
}